package com.ruoyi.web.controller.danger;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysDangerNode;
import com.ruoyi.system.service.ISysDangerNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dangerNode")
public class SysDangerNodeController extends BaseController {

    @Autowired
    private ISysDangerNodeService sysDangerNodeService;

    @PostMapping("/create")
    public AjaxResult create(@RequestBody SysDangerNode sysDangerNode) {
        sysDangerNodeService.create(sysDangerNode);
        return AjaxResult.success();
    }

    @GetMapping("/list")
    public TableDataInfo list(SysDangerNode sysDangerNode) {
        startPage();
        List<SysDangerNode> sysDangerNodeList = sysDangerNodeService.list(sysDangerNode);
        return getDataTable(sysDangerNodeList);
    }

    @GetMapping("/delete")
    public AjaxResult delete(Integer id) {
        sysDangerNodeService.delete(id);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody SysDangerNode sysDangerNode) {
        sysDangerNodeService.update(sysDangerNode);
        return AjaxResult.success();
    }

    @GetMapping("/deleteFile")
    public AjaxResult deleteFile(Integer id) {
        sysDangerNodeService.deleteFile(id);
        return AjaxResult.success();
    }
}
